Before Teiid 8.0, Dynamic VDB feature has capability to define source models and integrate data in those sources to by the end users. However there was no facility to define a View Layer where one can abstract integration of source layers to define logical views, such that the end user does not need to know about details about how those source layers are integrated.
Starting with Teiid 8.0 version, Dynamic VDB provides a facility to define models/schemas using DDL. Here is small example of how one can define a View inside the "-vdb.xml" file. See <metadata> element under <model>.
Example to show view definition
<model visible = "true" type = "VIRTUAL" name = "customers">
<metadata import-type = "DDL"><![CDATA[
CREATE VIEW PARTS (
PART_ID integer PRIMARY KEY,
PART_NAME varchar(255),
PART_COLOR varchar(30),
PART_WEIGHT varchar(255)
) AS
select a.id as PART_ID, a.name as PART_NAME, b.color as PART_COLOR, b.weight as PART_WEIGHT from modelA.part a, modelB.part b where a.id = b.id
]]>
<metadata>
</model>
Another complete DDL based example, at the end of this section.
Dynamic Repositories
The declaration of metadata using DDL is supported out of the box, however user can extend MetadataRepository interface to plug-in their own metadata facilities with this new feature. For example you can write a hibernate based store that can feed the necessary metadata just as below DDL. Using this facility user can essentially define a full virtual database without the help of the Teiid Designer. This can lead to design of virtual databases that are more dynamic in nature that can be changed programatically. See Custom Metadata Repository for more information.
Metadata for Source Models
The DDL based schema is not constrained to be defined only for the view models, users can also define source models, where <model type="PHISICAL">. This model is restricted to define only FOREIGN TABLES, PUSHDOWN FUNCTIONS, NON-VIRTUAL PROCEDURES.